package com.wp.exception;

import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author 卫鹏
 * @Description 异常处理类
 * @createTime 2021年11月11日 14:52:00
 */
public class WpExceptionResolver implements HandlerExceptionResolver {
    @Override
    public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) {
        //创建ModelAndView对象:
        ModelAndView mav = new ModelAndView();
        //直接跳转到错误页面：
        mav.setViewName("500");
        return mav;
    }
}
